package com.open4cn.simulator.answer;

import com.open4cn.simulator.core.answer.AbstractAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author yinxiaopeng
 * @version 1.0.0
 * @company 致景科技
 * @department 飞梭BU/研发
 * @description
 * @Email yinxiaopeng@zj.tech
 * @date 2022-05-13 01:32
 */
public class LogInstructionAction extends AbstractAction {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    public LogInstructionAction() {
        super(null);
    }

    public LogInstructionAction(AbstractAction action) {
        super(action);
    }

    @Override
    public void action(Object... params) {
        String instruction = (String) params[params.length - 1];
        logger.info("正在执行指令{}", instruction);
        if (hasNext()) {
            action.action(params);
        }
    }
}
